#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define sc(x) scanf("%d",&x)
#define sc2(x,y) scanf("%d",&x),scanf("%d",&y)
#define sc3(x,y,z) scanf("%d",&x),scanf("%d",&y),scanf("%d",&z)
#define scl(x) scanf("%lld",&x)
#define scl2(x,y) scanf("%lld",&x),scanf("%lld",&y)
#define pr(x) printf("%d\n",x)
#define prl(x) printf("%lld\n",x)
#define yes printf("Yes\n")
#define no printf ("No\n")
#define ll long long
#define pb push_back
#define F first
#define S second
#define forn() for(int i=0;i<n;i++)
#define pla_pla ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int N=2e5+1;
map<char,int> mp;
ll mod=1e9+7;
int main()
{
pla_pla
string s[8];
int n=8;
forn()
cin>>s[i];
int mw=16,mb=16;
for(int j=0;j<8;j++)
for(int i=n-1;i>=0;i--)
{
if(s[i][j]=='W')
{
int l=i-1;
while(l>=0&&s[l][j]!='B')
{
l--;
}
if(l==-1)
{ l++; mw=min(mw,i-l);}
}
}
for(int j=0;j<n;j++)
for(int i=0;i<n;i++)
{
if(s[i][j]=='B')
{
int l=i+1;
while(l<n&&s[l][j]!='W')
{
l++;
}
if(l==n)mb=min(mb,l-1-i);
}
}
if(mw<=mb)cout<<"A\n";
else cout<<"B\n";
}
174. Dungeon Game | 127. Word Ladder |
123. Best Time to Buy and Sell Stock III | 85. Maximal Rectangle |
84. Largest Rectangle in Histogram | 60. Permutation Sequence |
42. Trapping Rain Water | 32. Longest Valid Parentheses |
Cutting a material | Bubble Sort |
Number of triangles | AND path in a binary tree |
Factorial equations | Removal of vertices |
Happy segments | Cyclic shifts |
Zoos | Build a graph |
Almost correct bracket sequence | Count of integers |
Differences of the permutations | Doctor's Secret |
Back to School | I am Easy |
Teddy and Tweety | Partitioning binary strings |
Special sets | Smallest chosen word |
Going to office | Color the boxes |